package http_utils.utils;


import android.app.Activity;
import android.app.ProgressDialog;

public class LoadingUtils {
	private static ProgressDialog mProgressDialog;

	public static void progressDialogShow(Activity activity) {
		try {
			String message = "加载中……";
			mProgressDialog = new ProgressDialog(activity);
			mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
			mProgressDialog.setCancelable(true);
			mProgressDialog.setOwnerActivity(activity);
			mProgressDialog.setMessage(message);
			mProgressDialog.show();
		} catch (Exception e) {
		}
	}
//	public static void progressDialogShow(Activity activity,String message, DialogInterface.OnClickListener pause_listener) {
//		try {
//			mProgressDialog = new ProgressDialog(activity);
//			mProgressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
//			mProgressDialog.setCancelable(true);
//			mProgressDialog.setOwnerActivity(activity);
//			mProgressDialog.setMessage(message);
//			mProgressDialog.setButton(DialogInterface.BUTTON_POSITIVE,"暂停",pause_listener);
//			mProgressDialog.show();
//
//		} catch (Exception e) {
//		}
//	}
	public static void progressDialogDismiss() {
		if (mProgressDialog == null) {
			return;
		}
		if (mProgressDialog.isShowing()) {
			mProgressDialog.dismiss();
		}
	}

	public static void progressDialogUpdateMessage(String message) {
		if (mProgressDialog == null) {
			return;
		}
		mProgressDialog.setMessage(message);
	}
}
